Data manipulation across object levels

Hello,

One question for the experts.
I have a module which has several levels of objects. My level 3 objects have data in an attribute called "Tested" which is not present in the level 4 object under them.
This data has to be copied into the "Tested" attribute of the objects of level 4 which are under each particular level 3 object.

3.1.1 : Tested attribute has "COMPLETE"
3.1.1.1 : "COMPLETE" has to be pasted in Tested attribute
3.1.1.2 : "COMPLETE" has to be pasted in Tested attribute
3.1.1.3 : "COMPLETE" has to be pasted in Tested attribute

3.1.2 : Tested attribute has "CHECK RESULT"
3.1.2.1 : "CHECK RESULT" has to be pasted in Tested attribute
3.1.2.2 : "CHECK RESULT" has to be pasted in Tested attribute
3.1.2.3 : "CHECK RESULT" has to be pasted in Tested attribute

How to do this? I tried to apply column filters but that is too generic a search to find a specific Level 4. Any help?

Thanks,
Nayak
jnbharadhwaj - Mon Sep 17 01:23:57 EDT 2012

Re: Data manipulation across object levels
MichaelGeorg - Mon Sep 17 07:51:56 EDT 2012

Hello jnbharadhwaj,

for all I now just using filters will not do the job. Instead you will need to use some DXL script like:
 

Module m = current                 //you need execute the code from within the module you want to process
Object o, parO
 
for o in m do {                    //go through objects of current view of module and for objects of level-4...
  if(level(o) == 4) {
    parO = parent(o)               //fetch parent object and...
    o."Tested" = parO."Tested" ""  //copy value for attribute "Tested" from parent object to current level-4 object
  }
}

 


- Michael

 

Re: Data manipulation across object levels
adevicq - Mon Sep 17 08:26:38 EDT 2012

Hi,

Have you tried the "inherit value" flag in the attribute definition dialog box?

Alain

Re: Data manipulation across object levels
llandale - Mon Sep 17 14:12:27 EDT 2012

adevicq - Mon Sep 17 08:26:38 EDT 2012
Hi,

Have you tried the "inherit value" flag in the attribute definition dialog box?

Alain

Yes.

If your level 2 had no value for "tested" then your level 3 will inherit nothing. If you explictely set your level 3 to "Tested" then your level 4s will inherhit that value. You can change the value of the level 4 to perhaps "Failed" in which case it will no longer inherit.

The key is that an obj-attr value with inherit .. err .. appear to inherit it's parent value when it's value is null.
  • string Value = oLevel4."Status"
If Value is "Tested" you cannot tell if it is an explicit value or inherited. However:
  • AttrDef ad = find(mod, "Status")
  • string Value = oLevel4."Status"
  • if (Value == "Tested")
  • { if (hasSpecificValue(oLevel4, ad)) then Value is not inherited and someone explicitely set it to "Tested"
  • }

If you have level 5 objects and don't want to see "Tested", then you are forced to set all of them to something benign like a space.

-Louie

Re: Data manipulation across object levels
jnbharadhwaj - Tue Sep 18 04:07:34 EDT 2012

Hello,

Thanks for the many replies. It more than helped me. I am using the parent function for each level4 object to trace its parent level3 object. Also as per llandale's suggestion also am explicitly checking each level4 object to ensure that any data that MAY be present in the "Tested" attribute will not be over written.

Thanks again,
Nayak